home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / kiss-0.11 / kiss-0 / kiss / src / doread.c < prev    next >
C/C++ Source or Header  |  1995-03-23  |  537b  |  28 lines

  1. #include "kiss.h"
  2.  
  3. int doread (Stringstack s)
  4. {
  5.     char
  6.     buf [FILENAMELEN];
  7.     register char
  8.     *cp;
  9.     
  10.     if (s.nstr > 2 || getopt (s.nstr, s.str, "h") != -1)
  11.     return (warning ("Bad commandline.\n"
  12.              "Usage: read VAR - get input and set VAR to input\n"
  13.              "       read     - wait for input\n"));
  14.  
  15.     if (s.nstr == 2)
  16.     {
  17.     for (cp = s.str [1]; *cp; cp++)
  18.         if (! isupper (*cp))
  19.         return (warning ("variable must be in upper case"));
  20.     gets (buf);
  21.     addtoenv (s.str [1], buf);
  22.     }
  23.     else
  24.     gets (buf);
  25.     
  26.     return (0);
  27. }
  28.